/*
 * Copyright(C) 2019 FUYUN DATA SERVICES CO.,LTD. - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * 该源代码版权归属福韵数据服务有限公司所有
 * 未经授权，任何人不得复制、泄露、转载、使用，否则将视为侵权
 *
 */

import * as React from "react";
import { connect } from "react-redux";
import { Form, Input, Select, Button, InputNumber } from "antd";

import { FormComponentProps } from "antd/lib/form";

interface IState {
  edit: boolean;
}

interface IProps {
  edit: boolean;
}

class SecurityAdd extends React.Component<IProps & FormComponentProps, IState> {
  public state = {
    edit: false
  };

  public render() {
    const { getFieldDecorator } = this.props.form;
    return (
      <div>
        <Form>
          <Form.Item
            label={"生成批次"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "",
              rules: [
                {
                  required: false,
                  message: "生成批次"
                }
              ]
            })(<span>20190424212037</span>)}
          </Form.Item>

          <Form.Item
            label={"防伪码长度"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "",
              rules: [
                {
                  required: false,
                  message: "防伪码长度"
                }
              ]
            })(<span>20</span>)}
          </Form.Item>
          <Form.Item
            label={"防伪码前缀"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "",
              rules: [
                {
                  required: false,
                  message: "防伪码前缀"
                }
              ]
            })(<Input disabled={this.state.edit} />)}
          </Form.Item>
          <Form.Item
            label={"防伪码格式"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "0",
              rules: [
                {
                  required: false,
                  message: "防伪码格式"
                }
              ]
            })(
              <Select>
                <Select.Option value="0">前缀+数字和字母</Select.Option>
                <Select.Option value="1">前缀+数字</Select.Option>
                <Select.Option value="1">前缀+字母</Select.Option>
              </Select>
            )}
          </Form.Item>

          <Form.Item
            label={"条形码长度"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "0",
              rules: [
                {
                  required: false,
                  message: "条形码长度"
                }
              ]
            })(<InputNumber disabled={this.state.edit} />)}
          </Form.Item>

          <Form.Item
            label={"所属产品"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "0",
              rules: [
                {
                  required: false,
                  message: "所属产品"
                }
              ]
            })(<Input disabled={this.state.edit} />)}
          </Form.Item>

          <Form.Item
            label={"生成数量"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "0",
              rules: [
                {
                  required: false,
                  message: "生成数量"
                }
              ]
            })(<InputNumber disabled={this.state.edit} />)}
          </Form.Item>

          <Form.Item
            label={"经销商"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "0",
              rules: [
                {
                  required: false,
                  message: "经销商"
                }
              ]
            })(<Input disabled={this.state.edit} />)}
          </Form.Item>

          <Form.Item
            label={"是否启用"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "0",
              rules: [
                {
                  required: false,
                  message: "是否启用"
                }
              ]
            })(
              <Select>
                <Select.Option value="0">是</Select.Option>
                <Select.Option value="1">否</Select.Option>
              </Select>
            )}
          </Form.Item>

          <Form.Item
            label={"是否导出文件"}
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 12 }}
          >
            {getFieldDecorator("account", {
              initialValue: "0",
              rules: [
                {
                  required: false,
                  message: "是否启用"
                }
              ]
            })(
              <Select>
                <Select.Option value="0">是</Select.Option>
                <Select.Option value="1">否</Select.Option>
              </Select>
            )}
          </Form.Item>
        </Form>

        <div style={{ textAlign: "center" }}>
          <Button
            type="primary"
            style={{ marginRight: "20px", marginBottom: "20px" }}
          >
            保存
          </Button>
        </div>
      </div>
    );
  }
}

export default connect()(
  Form.create<IProps & FormComponentProps>({})(SecurityAdd)
);
